package com.neusoft.dibuy.myarray;

public class LinkedNodeList {
    private LinkedNode head;
    private LinkedNode tail;
    private int size;

    public static void main(String[] args) {
        LinkedNodeList list = new LinkedNodeList(500);
//        list.show();
        list.getMouse();
    }
    public void getMouse(){
        for (int i = 1; i < size; i++) {
            this.tail =  this.tail.next;
            this.tail =  this.tail.next;
            System.out.println(this.tail.next.no);
            this.tail.next =  this.tail.next.next;
        }
        System.out.println(this.tail.no);
    }
    public LinkedNodeList(int size){
        this.size =  size;
        LinkedNode node =  null;
        for (int i = 0; i <size ; i++ ) {
             LinkedNode temp   = new LinkedNode(i+1);
            if (i==0){
                head = temp;
                node = temp;
            }else {
                node.next = temp;
                node = temp;
            }
        }
        node.next = head;
        this.tail =  node;
    }
    public void show(){
        LinkedNode node = this.head;
        for (int  i = 0;  i < 11 ;  i++) {
            System.out.println(  node.no );
            node = node.next;
        }
    }
}
